package com.dyh.quickdemozwei.protect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

/**
 * @Author: yhdong
 * @Date: 2021/9/18 10:21
 */
@Aspect
@Component
public class UpdateProtectAspect {

    @Around("@annotation(com.dyh.quickdemozwei.protect.UpdateProtect)")
    public Object around(ProceedingJoinPoint pjp) throws Throwable {


        if ((boolean) RamOnlyConfig.get("updateProtect"))
            return null;
        // 执行目标 service
        Object result = pjp.proceed();

        return result;

    }

}
